package com.luntan.school.service.impl;

import com.luntan.school.dao.UserDao;
import com.luntan.school.dao.impl.UserDaolmpl;
import com.luntan.school.model.User;
import com.luntan.school.service.UserService;

import java.util.List;
import java.util.logging.Logger;

public class UserServiceImpl implements UserService {
     private static final Logger logger = Logger.getLogger("com.luntan.school");
     private UserDao userDao = new UserDaolmpl();
    @Override
    public User login(String account, String password) {
        logger.info("账户:" +account + " 登录......");
        return userDao.login(account,password);
    }

    @Override
    public boolean addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public boolean isUserExisted(String key, String value) {
        return userDao.isUserExist(key, value);
    }

    @Override
    public List<User> getAllUsers() {
        return userDao.getAllUsers();
    }

    @Override
    public void forbiddenUser(int userId, boolean forbidden) {
        userDao.forbiddenUser(userId,forbidden);
    }

    @Override
    public void updatePassword(String account, String password) {
        userDao.upDatePassword(account, password);
    }

    @Override
    public void updateUser(User user) {
        userDao.updateUserInfo(user);
    }

}
